﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace ThienLoc
{
    public partial class UCNavigate : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadMenu();
                LoadTinKhuyenMai();
            }
        }

        private void LoadMenu()
        {
            string sql = "SELECT * FROM dbo.tblTLMenu";
            DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, sql);
            foreach (DataRow item in dt.Rows)
            {
                ltrMenu.Text += "<li><a href='DanhSachMon.aspx?mid=" + item["ID"] + "'>" + item["Ten"] + "</a></li>";
            }
        }

        private void LoadTinKhuyenMai()
        {
            string sql = "SELECT * FROM dbo.tblTLContent WHERE MaDM = 'km'";
            DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, sql);
            foreach (DataRow item in dt.Rows)
            {
                ltrKhuyenMai.Text += "<li><a href='NoiDungKM.aspx?ID=" + item["ID"] + "'>" + item["TenDM"] + "</a> </li>";
            }
        }
    }
}